java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.persistence.jaxb.BeanValidationHelper

Challenge

You just installed GlassFish 4.1.1 and deployed your java jax-rs application to it and it fails with the above mentioned error.

java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.persistence.jaxb.BeanValidationHelper

Solution

Well as far as I found out it has not yet officially been fixed by Oracle.

A solution has been described there and I can confirm that for me it worked.

The solution was described in Spanish and after a bit of google translate I found out that the only thing you have to do is download this jar and copy it over the same file in the $GLASSFISHINSTALL/glassfish/modules folder

Restart the server and now your deployment should work.

I think it is kinda scandalous that it has not yet been fixed because it seems to be a year old bug.

If the origional link does not work you can download the file (zipped) from here. This file you have to unzip first before doing the rest as described above